//
//  AAWGame.h
//  AAWGameCore
//
//  Created by David Wagner on 29/06/2009.
//  Copyright 2009 Zygote Commando. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <OpenGLES/EAGL.h>
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>
#import "Box2D.h"

@class AAWGameCoreView;
@class AAWActor;

@interface AAWGame : NSObject <UIAccelerometerDelegate> 
{
@private
	AAWGameCoreView* view;

	NSTimeInterval lastUpdate;
	NSTimeInterval updateAccumulator;
	
	NSMutableArray* liveActors;
	NSMutableArray* deadActors;
	
	b2Vec2 gravity;
	b2World* world;
}

@property (readonly) float timerInterval;
@property (readonly) float updateInterval;
@property (readonly) float renderInterval;
@property (readonly) float maxCatchupInterval;
@property (readonly) b2World* world;
@property (readonly) BOOL canHireActors;

- (id)initWithView:(AAWGameCoreView*) gameCoreView;

- (void)hireActor:(AAWActor*)actor;
- (void)fireActor:(AAWActor*)actor immediately:(BOOL)immediately;

- (BOOL)isSceneDirty;

- (void)updatePhysics;

- (void)updateLogic;

- (void)render;

- (void)tick;

- (void)reset;

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event;
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event;
- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event;

@end
